Skip to main content

Save a result for this flow

5 minute read                                                                                                                         Beginner

Save a result for this flow:

It means storing the output or outcome of a specific flow run. This is useful for tracking user responses or decisions.


How to Create a Save Flow Result in Glific:

  1. Add a New Step:

    • In your flow, add a new node after collecting user input.
  2. Select "Save Flow Result":

    • Choose the Save Flow Result option from the dropdown.
  3. Configure the Result:

    • Result: Enter a unique name (e.g., user_rating).

    • Value: Use an expression like @(input) to save the user's response.

    • Category (Optional): Add a category like Rating.

  4. Save and Continue:

    • Click OK to save the configuration and proceed with the next step in your flow.
image image

This step allows you to store specific data when a contact reaches a particular point in a flow.

  1. Result:

    • Enter a unique name for the result, which you can reference later using @results.
    • You can either select an existing result or create a new one.
  2. Value:

    • Specify the value to be saved for the result.
    • You can use expressions to dynamically set the value, like @(title(input)).
    • Leaving this blank clears any previous value.
  3. Category (Optional):

    • Use this to categorize the result, e.g., if the value is 17, the category might be Young Adult.

Example 1:

  • If a flow collects a user's feedback rating as "4", you can save the result as feedback_rating with the value 4. You can then use @results.feedback_rating in subsequent steps to reference this value.

You want to collect user satisfaction ratings (1 to 5) after a support interaction.

Flow Steps:

  1. Ask for Feedback:

    • Send a message: "How would you rate your experience with us on a scale of 1 to 5?"
  2. Capture User Input:

    • Use a "Wait for Response" to collect the rating.
  3. Save the Result:

    • Use the "Save Flow Result" with the following configuration:
    • Result: user_rating
    • Value: @(input) (to capture the response)
    • Category: Rating (optional)
  4. Acknowledge:

    • Send a thank-you message: "Thank you for your feedback! Your rating of @results.user_rating is noted."

How It Works: - When the user responds with a number (e.g., "4"), it gets saved as user_rating with a value of 4. - You can use @results.user_rating later in the flow for analysis or follow-up.

Example 2:

  • Want to gather registration details, including preferred sessions and dietary preferences.

Flow Steps:

  1. Welcome Message:

    • Send a message: "Welcome to our upcoming virtual event! Let’s get you registered. Could you share your name?"
  2. Capture Name:

    • Use Wait for Response to get the user’s name.
  3. Save the Name:

    • Use Save Flow Result with the following configuration:
    • Result: user_name
    • Value: @(input)
    • Category: Registration
  4. Ask for Session Choice:

    • Send a message:
    • Which session are you most interested in? Options: Tech Innovations, Social Impact, Career Growth.
    • Use Wait for Response to capture the choice.
  5. Save the Session Choice:

    • Use Save Flow Result with the following configuration:
    • Result: session_preference
    • Value: @(input)
    • Category: Event Details
  6. Dietary Preferences (for On-site Attendees)- Check Attendance Type:

    • Send a message: Will you be attending virtually or on-site?
    • Use Wait for Response to get the answer.
  7. Save Attendance Type:

    • Use Save Flow Result with the following configuration:
    • Result: attendance_type
    • Value: @(input)
    • Category: Event Details
  8. Conditional Question:

    • If @results.attendance_type is "On-site", proceed to Step 9.
    • If "Virtual", skip to Step 11.
  9. On-site Specific Information- Ask for Dietary Preference:

    • Send a message: Please let us know your dietary preference: Vegetarian, Non-Vegetarian, Vegan.
    • Use Wait for Response to collect the preference.
  10. Save Dietary Preference:

    • Use Save Flow Result with the following configuration:
    • Result: dietary_preference
    • Value: @(input)
    • Category: Event Details
  11. Send a personalized message:

    • "Thank you, @results.user_name! You are registered for the event. You have chosen the @results.session_preference session and will be attending @results.attendance_type. @if(@results.attendance_type == 'On-site') Your dietary preference is @results.dietary_preference."

How It Works:

  • This flow dynamically adapts to whether the user is attending virtually or on-site.

  • The data collected can be used to send personalized event reminders and follow-up messages, making the experience more tailored and efficient.